home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Libraries
/
MacTCP class library
/
MacTCP class headers
/
CTCPClient.h
< prev
Wrap
Text File
|
1992-10-26
|
4KB
|
119 lines
/*
CTCPClient.h
Superclass: CCollaborator
The TCP client implementation for CTCP
Copyright © NCSA, University of Illinois; June 3, 1992
Eric Johnson, John Newlin and Igor Livshits
This code may be used, modified, and distributed free of charge and obligation.
*/
#define _H_CTCPClient // Include this file only once
#include <CCollaborator.h> // Superclass definitions
#include "CTCP.h"
#include "CDNR.h"
#define kDefaultRetries 5 // Retry an action five times
#define kDotAddressLength 16 // Usual length of the dot address
#define kDNRSize 8192 // Memeory needed for a DNR ac =tion
/*=====================*/
/*===---------------===*/
struct CTCPClient : CCollaborator
Begin
protected:
CTCP* itsStream; // Our TCP stream object
long numRetries; // How many times to try an action
Handle itsBuffer; // A place to store data that we read in.
public:
OSErr ITCPClient // Initialize this object
( void // No arguments
);
void Dispose // Destroy our object
( void // No arguments
);
virtual OSErr Create // Create a stream
( Size streamLength // Size of the stream buffer
);
virtual OSErr OpenConnection // Open a connection
( void // No arguments
);
virtual OSErr WaitForConnection // Wait for incoming connection
( void // No arguments
);
virtual OSErr SendData // Send some data over
( Ptr data, // Data to send
Size length // Size of oour data
);
virtual OSErr ReceiveData // Receive data
( Ptr* data, // Where to place received data
Size* length // Size of our data
);
virtual OSErr MyBufferReceiveData // Receive data into specified buffer
( Ptr data, // Where to place received data
Size* length // Size of our data
);
virtual OSErr Close // Close current connection
( void // No arguments
);
virtual OSErr Abort // Abort current connection
( void // No arguments
);
virtual OSErr Quit // Quit our stream
( void // No arguments
);
virtual OSErr Kill // Kill our stream
( void // No arguments
);
virtual void SetRetries // Set the retry count
( long count // How many times
);
virtual CTCP* GetStream // Fetch our stream object
( void // No arguments
);
virtual void SetAddress // Set up remote address (Resolve if necessary)
( char* name, // Name of the remote machine
ip_addr address, // Address of the remote machine
ip_port port // A remote port we are seeking
);
virtual OSErr ResolveAddress // Resolve remote address
( char* name, // Name of the remote machine
ip_addr* address // Address of the remote machine
);
virtual OSErr GetLocalAddress // Fetch local IP address
( ip_addr* address // Address of our machine
);
virtual OSErr GetLocalDotAddress // Fetch local IP address as a string
( char* dotAddress // Address of our machine in dot notation
);
virtual void ReadData // Fill the internal buffer from MacTCP
( void
);
virtual void ReleaseBuffer // Dispose of itsBuffer.
( void
);
virtual void GetLine // Copy the next line into whatever line points too.
( Ptr line // A buffer to copy the line into.
);
virtual Size HowLongNextLine // Return the number of bytes in the next line.
( void
);
End;
/*===---------------===*/
/*=====================*/